Ext.define('appfe.stockor.statist.buyinpoint.BuyinPointModel', {
    extend: 'Ext.app.ViewModel',
    alias: 'viewmodel.stockor.statist.buyinpoint.BuyinPoint',
    data: {
    },
    stores: {
        queryKeyStore: {
            fields: ['text', 'code', 'type'],
            data: [
                ['ID', 'id', 'int'],
                ['简码', 'slimsymbol', 'string'],
                ['名称', 'name', 'string']
            ]
        },
        queryInfoTimeTypeStore: {
            fields: ['text', 'code', 'type'],
            data: [
                ['当前时', 'logTime', 'string'],
                ['背驰时', 'pointTime', 'string']
            ]
        },
        buyinPointStatusStore: {
            fields: ['text', 'code', 'tip'],
            data: [
                ['新建', 'NEW', '新建状态'],
                ['有效', 'OPEN', '有效状态'],
                ['关闭', 'CLOSE', '关闭状态']
            ]
        },
        buyinPointStore: {
            fields: [
                { name: 'id', type: 'int' },
                { name: 'slimsymbol', type: 'string' },
                { name: 'name', type: 'string' },
                { name: 'grade', type: 'string' },
                { name: 'status', type: 'string' },
                { name: 'offsetDays', type: 'int' },

                { name: 'infoTime', type: 'date' },
                { name: 'topenPrice', type: 'float' },
                { name: 'tclosePrice', type: 'float' },
                { name: 'thighPrice', type: 'float' },
                { name: 'tlowPrice', type: 'float' },

                { name: 'lowestInfoTime', type: 'date' },
                { name: 'lowestTopenPrice', type: 'float' },
                { name: 'lowestTclosePrice', type: 'float' },
                { name: 'lowestThighPrice', type: 'float' },
                { name: 'lowestTlowPrice', type: 'float' },

                { name: 'logInfoTime', type: 'date' },
                { name: 'logTopenPrice', type: 'float' },
                { name: 'logTclosePrice', type: 'float' },
                { name: 'logThighPrice', type: 'float' },
                { name: 'logTlowPrice', type: 'float' },

                { name: 'closeOverMa5', type: 'boolean' },
                { name: 'ma5OverMa10', type: 'boolean' },
                { name: 'ma5OverMa13', type: 'boolean' },
                { name: 'macdSlope', type: 'float' },

                { name: 'tcloseIncreaseAmount', type: 'float' },
                { name: 'tcloseProfitRatio', type: 'float' },

                { name: 'backoff34TermsIslowest', type: 'boolean' },
                { name: 'backoff55TermsIslowest', type: 'boolean' },
                { name: 'backoff89TermsIslowest', type: 'boolean' },
                { name: 'backoff144TermsIslowest', type: 'boolean' },
                { name: 'createDate', type: 'date' },
                { name: 'modifyDate', type: 'date' },
                { name: 'comments', type: 'string' },

                ////////
                { name: 'realtimeStatus', type: 'string' },//用于显示现价买入点分析的信息显示
                { name: 'realtimeInfoTime', type: 'string' },
                { name: 'realtimeTopenPrice', type: 'string' },
                { name: 'realtimeTclosePrice', type: 'string' },
                { name: 'realtimeThighPrice', type: 'string' },
                { name: 'realtimeTlowPrice', type: 'string' },
                { name: 'realtimetCloseIncreaseAmount', type: 'string' },
                { name: 'realtimetCloseProfitRatio', type: 'string' },
                { name: 'realtimeBackoff34TermsIslowest', type: 'boolean' },
                { name: 'realtimeBackoff55TermsIslowest', type: 'boolean' },
                { name: 'realtimeBackoff89TermsIslowest', type: 'boolean' },
                { name: 'realtimeBackoff144TermsIslowest', type: 'boolean' },


                { name: 'currentTime', type: 'string' },
                { name: 'currentPrice', type: 'string' },
                { name: 'currentOpen', type: 'string' },
                { name: 'currentHigh', type: 'string' },
                { name: 'currentLow', type: 'string' }



            ],
            autoLoad: false, //不自动加载, 只有用户查询的时候才load数据, 
            //autoSync: false, //Record变化自动通过Proxy同步, 默认false.
            //autoSort: true,
            remoteSort: true,
            //pageSize: 30,
            proxy: {
                type: 'ajax',
                url: BizHttpAction.queryBuyinPointWithLog.url,
                reader: {
                    type: 'json',
                    rootProperty: 'data',
                    totalProperty: 'total',
                    successProperty: 'success'
                },
                simpleSortMode: true // sends single sort as multi parameter
            },
            sorters: [
                { property: 'infoTime', direction: 'DESC' }
            ]
            // ,listeners: {
            //     sort: 'updateSort',
            //     refresh: 'updateSort',
            //     buffer: 10
            // }
        }
    }
});
